<template>
  <div>
    <span class="android"> 这里将要显示android传递给我的内容::</span>
    <div ref="test" />

    <input v-model="myMsg" />

    <div @click="handleClick">点击传参给原生App</div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      msg: "",
      myMsg: "",
    };
  },
  mounted () {
    window.onDiyClick = (msg) => {
      this.$refs.test.innerHTML = msg;
    };
  },
  methods: {
    handleClick () {
      // js2Android和show都需要android定义  属于随便起的
      // js2Android也可以起名字叫jsbridge  只要和android约定好就行

      js2Android.show(this.myMsg);
    },
  },
};
</script>
<style>
.android {
  color: red;
}
</style>
